package com.javasm.transfer;

import com.javasm.domin.entity.AftersaleOut;
import com.javasm.domin.vo.AftersaleOutVo;
import com.javasm.transfer.base.BaseTransfer;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.List;

import static com.javasm.common.dictionary.AfterinitContext.afdic;

@Component
@RequiredArgsConstructor
public class AftersaleOutTransfer extends BaseTransfer<AftersaleOut, AftersaleOutVo> {


    public List<AftersaleOutVo> jotoVo(List<AftersaleOut> list){
        List<AftersaleOutVo> aftersaleOutVos = super.toVO(list);

        for (int i = 0; i < aftersaleOutVos.size(); i++) {
            //拿到AftersaleOut对象
            AftersaleOut aftersaleOut = list.get(i);
            AftersaleOutVo aftersaleOutVo = aftersaleOutVos.get(i);

            if(aftersaleOut.getOutSignId()!=null&&aftersaleOut.getOutSignId()!=0){
                aftersaleOutVo.setOutSignName(afdic.get(1).get(aftersaleOut.getOutSignId()));
            }
            if(aftersaleOut.getBatchState()!=null&&aftersaleOut.getBatchState()!=0){
                aftersaleOutVo.setBatchStatename(afdic.get(2).get(aftersaleOut.getBatchState()));
            }
            if(aftersaleOut.getNumberState()!=null&&aftersaleOut.getNumberState()!=0){
                aftersaleOutVo.setNumberState(afdic.get(3).get(aftersaleOut.getNumberState()));
            }

        }

        return aftersaleOutVos;
    }
}
